package com.cs.usser.web;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class MQProduct {

    @Resource
    private RabbitTemplate rabbitTemplate;
    @GetMapping("fanout")
    public String fanoutMessage(String data){
        for (int i = 0; i < 10; i++) {
            rabbitTemplate.convertAndSend("fanoutTest",
                    ""+
                    "msg"+i+":"+data);
        }
        return "fanoutTest "+data;
    }
}
